package xyz.yolin.utils;

import xyz.yolin.pojo.Admin;

import javax.servlet.http.HttpServletRequest;

public class SessionUtils {
    public static void setAdmin(HttpServletRequest request, Admin admin){
        request.getSession().setAttribute("admin",admin);
    }
    public static Admin getAdmin(HttpServletRequest request){
        if(request.getSession().getAttribute("admin")!=null){
            return (Admin) request.getSession().getAttribute("admin");
        }else{
            return null;
        }

    }
}
